package com.zhuojy.equity.mall.admin.web.controller;


import com.zhuojy.equity.mall.admin.common.entity.TUser;
import com.zhuojy.equity.mall.admin.service.DemoService;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequiredArgsConstructor
@RequestMapping("demo")
public class DemoController {
    private  final DemoService demoService;
    @RequestMapping("findAll")
    void findAll(){
        demoService.findAll();
    }

    @ApiOperation(value = "员工列表查询", httpMethod = "POST", notes = "员工列表查询")
    @RequestMapping("findTUserList")
    List<TUser> findTUserList(Long id){
       return demoService.findTUserList(id);
    }

    /**
     * @description: 根据id查找TUser和TAudit
     * @author: lyl
     * @date: 2024/3/25 19:35
     * @param: id    审批人
     * @return: com.zhuojy.equity.mall.admin.common.entity.TUser
     **/
    @ApiOperation(value = "根据id查询", httpMethod = "POST", notes = "根据id查询")
    @RequestMapping("findUserAndAuditById")
    TUser findUserAndAuditById(@RequestParam("id") Long id,@RequestParam("sponsorId") Integer sponsorId){
        return demoService.findUserAndAuditById(id,sponsorId);
    }

    /**
     * @description:根据id查找TUser和TAudit
     * @author: lyl
     * @date: 2024/3/26 14:55
     * @param: id 抄送人
     * @param: sponsorId
     * @return: com.zhuojy.equity.mall.admin.common.entity.TUser
     **/
    @ApiOperation(value = "根据id查询", httpMethod = "POST", notes = "根据id查询")
    @RequestMapping("findUserAndAuditById2")
    TUser findUserAndAuditById2(@RequestParam("id") String id,@RequestParam("sponsorId") String sponsorId){
        System.out.println(id+""+sponsorId);
        return demoService.findUserAndAuditById2(Long.parseLong(id),Integer.parseInt(sponsorId));
    }
    /**
    * @Author Csh
    * @Description 查询指定Id的用户
    * @Date 20:56 2024/3/25
    * @Param [id]
    * @return com.zhuojy.equity.mall.admin.common.entity.TUser
    **/

    @RequestMapping("findOneUser")
    TUser findOneUser(Long id){
        return demoService.findOneUser(id);
    }
    /**
     * @description:根据id查找TUser和TCarUse
     * @author: 瑞雪
     * @date: 2024/3/26 14:55
     * @param: id 抄送人
     * @param: sponsorId
     * @return: com.zhuojy.equity.mall.admin.common.entity.TUser
     **/
    @ApiOperation(value = "根据id查询", httpMethod = "POST", notes = "根据id查询")
    @RequestMapping("findUserAndAuditById3")
    TUser findUserAndAuditById3(@RequestParam("id") String id,@RequestParam("carUserId") String carUserId){
        System.out.println(id+""+carUserId);
        return demoService.findUserAndAuditById3(Long.parseLong(id),Integer.parseInt(carUserId));
    }
    /**
     * @description:根据id查找TUser和TCarUse
     * @author: 瑞雪
     * @date: 2024/3/26 14:55
     * @param: id 抄送人
     * @param: sponsorId
     * @return: com.zhuojy.equity.mall.admin.common.entity.TUser
     **/
    @ApiOperation(value = "根据id查询", httpMethod = "POST", notes = "根据id查询")
    @RequestMapping("findUserAndAuditById4")
    TUser findUserAndAuditById4(@RequestParam("id") Long id,@RequestParam("carUserId") Integer carUserId){
        return demoService.findUserAndAuditById4(id,carUserId);
    }

    @ApiOperation(value = "报销借款审批人", httpMethod = "POST", notes = "报销借款审批人")
    @RequestMapping("findUserAndExpenseById")
    TUser findUserAndExpenseById(@RequestParam("id") Long id,@RequestParam("sponsorId") Integer sponsorId){
        return demoService.findUserAndExpenseById(id,sponsorId);
    }

    @ApiOperation(value = "报销借款抄送人", httpMethod = "POST", notes = "报销借款抄送人")
    @RequestMapping("findUserAndExpenseById2")
    TUser findUserAndExpenseById2(@RequestParam("id") Long id,@RequestParam("sponsorId") Integer sponsorId){
        return demoService.findUserAndExpenseById2(id,sponsorId);
    }
}
